load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "bindinfo",
    srcs = [
        "binding.go",
        "binding_auto.go",
        "binding_cache.go",
        "binding_handle.go",
        "binding_operator.go",
        "binding_plan_evolution.go",
        "binding_plan_generation.go",
        "session_handle.go",
        "utils.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/bindinfo",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/kv",
        "//pkg/metrics",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/format",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/planner/core/base",
        "//pkg/planner/core/resolve",
        "//pkg/planner/util/fixcontrol",
        "//pkg/sessionctx",
        "//pkg/sessionctx/sessionstates",
        "//pkg/sessionctx/vardef",
        "//pkg/sessionctx/variable",
        "//pkg/types",
        "//pkg/types/parser_driver",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/hack",
        "//pkg/util/hint",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/parser",
        "//pkg/util/sqlexec",
        "@com_github_dgraph_io_ristretto//:ristretto",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pkg_errors//:errors",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "bindinfo_test",
    timeout = "moderate",
    srcs = [
        "binding_auto_test.go",
        "binding_cache_test.go",
        "binding_operator_test.go",
        "binding_plan_evolution_test.go",
        "binding_plan_generation_test.go",
        "main_test.go",
        "session_handle_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":bindinfo"],
    flaky = True,
    shard_count = 44,
    deps = [
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/format",
        "//pkg/parser/terror",
        "//pkg/planner/util/fixcontrol",
        "//pkg/server",
        "//pkg/session/sessionapi",
        "//pkg/sessionctx/vardef",
        "//pkg/testkit",
        "//pkg/testkit/testdata",
        "//pkg/testkit/testmain",
        "//pkg/testkit/testsetup",
        "//pkg/util/stmtsummary",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
